Compasses and accelerometers are being used in commercial products, particularly in video gaming, automotive and navigational systems. InvenSense Inc., the assignee of the present invention, is a pioneer in the field of using a combination of gyroscopes, accelerometers and compasses in handheld commercial devices such as wireless phones, video gaming systems, cameras, user authentication devices and other devices in which motion sensing is done. An accelerometer is used for measuring linear acceleration, a compass is used for determining direction relative to the earth's magnetic pole, and a gyroscope is used for measuring or maintaining orientation based on the Coriolis Effect.
Bias errors are associated with both compasses and gyroscopes. The bias error in a compass makes it difficult to determine earth's magnetic North pole. The bias offset of a gyroscope, also known as the null voltage, is the measured voltage when the gyro is not rotating about its sensitive axis. Gyro output voltage measurements above the bias offset indicate rotation in one direction (e.g., clockwise), while voltage measurements below the bias offset indicate rotation in the opposite direction (e.g., counter-clockwise). If the gyro bias offset is not corrected, it can result in a continuous drift.
Large bias errors are common in compasses due to the nature of low cost Hall sensor based compasses. The conventional method of calibrating a compass on the fly is to use the knowledge that, when all calibration parameters are found, the magnitudes of the X, Y, and Z compass measurements should always equal the same value, namely, the value of the magnetic field vector that the compass is measuring.
A least squares method (or other standard linear algebra method) can be used that solves the equation: (X−Xbias)^2+(Y−Ybias)^2+(Z−Zbias)^2=M^2, in which M is the magnitude of the magnetic field vector and ^2 represents square (algebra). Conventionally, this equation is solved for Xbias, Ybias, and Zbias. A problem with this method is that it requires the user to move the device having the compass in a complex trajectory (e.g. a figure eight) in order for this method to have enough information to converge.
With respect to gyroscopes, conventionally, when a gyroscope is used in combination with an accelerometer and a compass, any offset in the gyroscope data can be compensated by the accelerometer in pitch and roll, and the compass in yaw. However, at times the compass and/or the accelerometer data can become unreliable. And because elimination of the offset error is instantaneous, the conventional method is only applicable with the accelerometer and compass data is reliable and is used. If, for example, the compass data becomes unreliable due to magnetic interference etc. or the accelerometer data becomes unreliable because of the presence of high linear accelerations, the compass data and/or the accelerometer data cannot be used. In that case, any existing gyro bias error would be uncompensated and result in a continuous drift.